package com.azunitech.intercpt.ejb;

import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

import org.apache.log4j.Logger;

/**
 * Message-Driven Bean implementation class for: JMSInterceptorMDB
 */
@MessageDriven(mappedName="Queue-Interceptor-001",
		activationConfig = { @ActivationConfigProperty(
				propertyName = "destinationType", propertyValue = "javax.jms.Queue")
		})
public class JMSInterceptorMDB implements MessageListener {
	private Logger s_Logger = Logger.getLogger(JMSInterceptorMDB.class);
    /**
     * Default constructor. 
     */
    public JMSInterceptorMDB() {
        // TODO Auto-generated constructor stub
    }
	
	/**
     * @see MessageListener#onMessage(Message)
     */
    public void onMessage(Message inMessage) {
		TextMessage msg = null;
		s_Logger.info("############################## " + inMessage.toString());
	      try {
				s_Logger.info(inMessage.getJMSDestination());
				if (inMessage instanceof TextMessage) {
					msg = (TextMessage) inMessage;
				}
         } 
         catch (JMSException e) {
             e.printStackTrace();
         } 
         catch (Throwable te) {
             te.printStackTrace();
         }
    }

}
